<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: table_myrepeats.php 31512 2012-09-04 07:11:08Z monkey $
 */
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

class table_zhibo extends discuz_table
{
	public function __construct() {

		$this->_table = 'zhibo';
		$this->_pk    = '';

		parent::__construct();
	}

	//获取数据列表
	public function getList() {
		return DB::fetch_all("SELECT * FROM %t ORDER BY id DESC", array($this->_table));
	}

	//根据id获取channelId
	public function getByIdChannelId($id) {
		return DB::result_first("SELECT channelId FROM %t WHERE id=%d", array($this->_table,$id));
	}

	//根据channelId  删除数据
	public function delByIdChannelId($channelId) {
		DB::query("DELETE FROM %t WHERE channelId=%s", array($this->_table, $channelId));
	}

	//接受数据并写入
	public function add($data){
		DB::insert($this->_table,$data);
		return mysql_insert_id();
	}

	//根据id查询编辑信息
	public function getByIdDetails($id){
		return DB::fetch_all("SELECT * FROM %t WHERE id=%d", array($this->_table,$id));
	}

	//根据id查询更新信息
	public function update_comment_by_uid_username($id, $username, $value) {

//		DB::query("UPDATE %t SET comment=%s WHERE id=%d AND username=%s", array($this->_table, $value, $id, $username));
	}

	public function update_star($id){
		DB::query("UPDATE %t SET star=star+1 WHERE id=%d", array($this->_table,$id));
	}
}

?>